package com.zyg.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zyg.pojo.Permission;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PermissionMapper extends BaseMapper<Permission> {
    @Select("SELECT DISTINCT sp.perms " +
            "FROM sys_user su " +
            "JOIN user_role ur ON su.id = ur.u_id " +
            "JOIN sys_role sr ON ur.r_id = sr.role_id " +
            "JOIN role_permission rp ON sr.role_id = rp.r_id " +
            "JOIN sys_permission sp ON rp.p_id = sp.id " +
            "WHERE su.id = #{loginId}")
    public List<String> getPermissionList(Object loginId);


}